package com.ws.log
{
	import com.ws.utils.StringFormatter;
	
	import mx.logging.ILogger;
	import mx.logging.Log;
	import mx.logging.LogLogger;

	public class WSLog
	{
		private static var logger:ILogger;
		public static function getInstance(category:String="ws.game"):ILogger{
			if(!logger){
				logger =Log.getLogger(category);
			}
			return logger;
		}
		
		public static function error(message:String,... args):void{
			getInstance().error(message,args);
			flTrace(message,args);
		}
		
		public static function info(message:String, ... args):void{
			getInstance().info(message,args);
			flTrace(message,args);
		}
		
		public static function flTrace(message:String,args:Array):void{		
			for (var i:int = 0; i < args.length; i++){
				message = message.replace(new RegExp("\\{"+i+"\\}", "g"), args[i]);
			}
			trace(message);
		}
	}
}